import { RouteRecordRaw } from 'vue-router';
import { Layout } from '@/router/constant';
import { OptionsSharp } from '@vicons/ionicons5';
import { renderIcon } from '@/utils/index';

/**
 * @param name 路由名称, 必须设置,且不能重名
 * @param meta 路由元信息（路由附带扩展信息）
 * @param redirect 重定向地址, 访问这个路由时,自定进行重定向
 * @param meta.disabled 禁用整个菜单
 * @param meta.title 菜单名称
 * @param meta.icon 菜单图标
 * @param meta.keepAlive 缓存该路由
 * @param meta.sort 排序越小越排前
 *
 * */
const routes: Array<RouteRecordRaw> = [
  {
    path: '/system',
    name: 'System',
    redirect: '/system/param',
    component: Layout,
    meta: {
      title: '系统管理',
      icon: renderIcon(OptionsSharp),
      sort: 1,
      permissions: ['system_param','system_gateway','system_governance','system_login_log','system_ops_log'],
    },
    children: [
      {
        path: 'param',
        name: 'system_param',
        meta: {
          title: '参数配置',
          permissions: ['system_param'],
        },
        component: () => import('@/views/system/param/param.vue'),
      },
      {
        path: 'gateway',
        name: 'system_gateway',
        meta: {
          title: '网关路由',
          permissions: ['system_gateway'],
        },
        component: () => import('@/views/system/gateway/gateway.vue'),
      },
      {
        path: 'client',
        name: 'system-client',
        meta: {
          title: '客户端管理',
          permissions: ['system_client'],
        },
        component: () => import('@/views/system/sysClient/sysClient.vue'),
      },
      {
        path: 'login_log',
        name: 'system_login_log',
        meta: {
          title: '登录日志',
          permissions: ['system_login_log'],
        },
        component: () => import('@/views/system/loginLog/loginLog.vue'),
      },
      {
        path: 'ops_log',
        name: 'system_ops_log',
        meta: {
          title: '操作日志',
          permissions: ['system_ops_log'],
        },
        component: () => import('@/views/system/opsLog/opsLog.vue'),
      },
      {
        path: 'dict',
        name: 'system_dict',
        meta: {
          title: '字典管理',
          permissions: ['system_dict'],
        },
        component: () => import('@/views/system/dict/dict.vue'),
      },
      {
        path: 'region',
        name: 'system_region',
        meta: {
          title: '行政区划管理',
          permissions: ['system_region'],
        },
        component: () => import('@/views/system/region/region.vue'),
      },
    ],
  },
];

export default routes;
